<%@page import="com.shsh.safemanage.model.ManageGroup"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.TitlePostManageGroupDao"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<%
TitlePostManageGroupDao manageGroupDao = DaoCreator.createTitlePostManageGroupDao();
List<ManageGroup> manageGroupList = manageGroupDao.getManageGroupList();
%>
<table width="400" border="1" cellpadding="0" cellspacing="0">
	<%
	for (int i = 0; i < 100; i++) {
	%>
	<tr>
		<%
		for (int j = 0; j < 3; j++) {
			int index = i * 3 + j;
			if (index >= manageGroupList.size()) {
				break;
			}
			ManageGroup manageGroup = manageGroupList.get(index);
		%>
		<td align="center"><a href="#" onclick="chooseMappingManageGroup(<%=manageGroup.getId()%>)"><%=manageGroup.getManageGroupName()%></a></td>
		<%
		}
		%>
	</tr>
	<%
	}
	%>
</table>

<script type="text/javascript">
function chooseMappingManageGroup(id) {
	$.dialog.get('manageGroupDialog').close();
	openWaitingDialog('waitingDialog');
	$.ajax({
		type:'post',
		url:'choose_manage_group_process.jsp',
		data:{
			id: id
		},
		success:function(data,state,xmlhttp){
			var obj = null;
			try {
				obj = eval('(' + data + ')');
			} catch (e) {
			}
			if (typeof(obj.isSuccess) != 'undefined') {
				if (obj.isSuccess == 'true') {
					loadPageSection('<%=request.getContextPath()%>/register.jsp', 'mainContentDiv');
				} else {
					closeWaitingDialog('waitingDialog');
					$.dialog.alert(obj.error);
				}
			}
		}
	});
}
</script>
